package com.zy.dao;

import com.zy.entity.Video;
import com.zy.entity.VideoText;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface ManagementMapper
{

    /**
     * 后台视频管理搜索视频
     * @param begin
     * @param pageSize
     * @param typeName
     * @param userName
     * @return
     */
    public List<VideoText> searchVideoListByBeginAndPageSizeAndTypeNameOrUserName(int begin, int pageSize, String typeName, String userName);

    /**
     * 通过用户名和类型查找数量
     * @param typeName
     * @param userName
     * @return
     */
    public int videoNumByTypeNameOrUserName(String typeName, String userName);

    /**
     * 通过id查询删除信息并返回信息
     * @param id
     */
    public void deleteVideoById(int id);

    /**
     * 统计视频每月数量
     * @param time
     * @return
     */
    @Select("SELECT COUNT(*) FROM videoweb_video WHERE create_time LIKE CONCAT(#{time},'%')")
    public int selectVideoCount(@Param("time") String time);

    /**
     * 统计每月视频数量
     * @param time
     * @return
     */
    @Select("SELECT COUNT(*) FROM videoweb_video WHERE create_time LIKE CONCAT(#{time},'%')")
    public int selectVideoCount2(@Param("time") String time);

    /**
     * 统计个人每月视频数量
     * @param time
     * @param userId
     * @return
     */
    @Select("SELECT COUNT(*) FROM videoweb_video WHERE user_id = #{userId} AND create_time LIKE CONCAT(#{time},'%')")
    public int selectPersionalVideoCount(@Param("time") String time,@Param("userId") int userId);

}
